Add paint-timing test when child iframe paints This CL adds a test with a frame having a child iframe that renders an image. the parent should only get a first-paint entry even after the child has rendered the image. An upstream spec issue had been filed to clarify: https://github.com/w3c/paint-timing/issues/22 Bug: 736114 Change-Id: Idc0910a7acc8f8af3bf9634a7e6827805fe8d370 Reviewed-on: https://chromium-review.googlesource.com/766393 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Timothy Dresser <tdresser@chromium.org> Cr-Commit-Position: refs/heads/master@{#516339} 
diff --git a/paint-timing/child-painting-first-image.html b/paint-timing/child-painting-first-image.html new file mode 100644 index 0000000..99f761f --- /dev/null +++ b/paint-timing/child-painting-first-image.html 
@@ -0,0 +1,26 @@ +<!DOCTYPE html> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script> +async_test(function (t) { + window.addEventListener('message', t.step_func(e => { + assert_equals(e.data, '2 paint first-paint paint first-contentful-paint'); + const bufferedEntries = performance.getEntriesByType('paint'); + // When only child frame paints, expect only first-paint. + t.step_timeout( function() { + assert_equals(bufferedEntries.length, 1); + assert_equals(bufferedEntries[0].entryType, 'paint'); + assert_equals(bufferedEntries[0].name, 'first-paint'); + t.done(); + }, 50); + })); + const iframe = document.createElement('iframe'); + iframe.id = 'child-iframe'; + iframe.src = 'resources/subframe-painting.html'; + document.body.appendChild(iframe); +}, 'Parent frame ignores paint-timing events fired from child image rendering.'); +</script> +</body> +</html>